'use strict'
const { query } = require('../app/helper/db');

module.exports.up = function (next) {
  query(`
    CREATE TABLE orderProductOption (
      id int(11) unsigned NOT NULL AUTO_INCREMENT,
      productid int(11) unsigned NOT NULL comment '',
      orderid int(11) unsigned NOT NULL comment '',
      name varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL comment '',
      price int(11) unsigned NOT NULL comment '',
      originPrice int(11) unsigned NOT NULL comment '',
      count int(11) unsigned NOT NULL comment '',
      createdat int(11) NOT NULL comment '',
      PRIMARY KEY (id)
    ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
  `).then(() => {
    next();
  }).catch(err => {
    throw err;
  })
}

module.exports.down = function (next) {
  next()
}
